//
//  ThirdSplashAd.swift
//  ThirdSplashAd
//
//  Created by 张亚浩 on 2023/5/31.
//

import Foundation

public protocol ThirdSplashAdStatusListener {
    func onAdLoaded(detailMap: Dictionary<String, Any>)
    func onAdLoadTimeout()
    func onNoAdError(code: String, desc: String)
    func onAdShow(detailMap: Dictionary<String, Any>)
    func onAdClick()
    func onAdDismiss()
}

public protocol ThirdSplashAdProtocol {
    
    func initConfig()
    
    /*
     * 加载广告
     * @return 加载成功、失败
     */
    func load()
    
    /*
     * 显示广告
     * @return 广告显示+消失、广告未显示
     */
    func show(customSkipView: UIView?)
    
    func isReady() -> Bool
    
    func isShowing() -> Bool
    
    func setThirdSplashAdStatusListener(listener: ThirdSplashAdStatusListener)
    
}

open class ThirdSplashAd: NSObject, ThirdSplashAdProtocol {
    
    public var placementId: String;
    public init(appId: String, appKey: String, placementId: String) {
        self.placementId = placementId
    }
    
    open func initConfig() {}
    
    open func load() {}
    
    open func show(customSkipView: UIView?) {}
    
    open func isReady() -> Bool {
        return false
    }
    
    open func isShowing() -> Bool {
        return false
    }
    
    open func setThirdSplashAdStatusListener(listener: ThirdSplashAdStatusListener) {
    }
    
}
